PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Solved
Solved
rogeryelvington

Jun 13th, 2022 02:42 AM

Hi Devs, I am trying to send email using SMTP, my application is hosted on DigitalOcean, whenever I tried sending email, it gives me this error,

"ErrorException: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in file /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php on line 94"

Can anyone assist me plz.

bobbyiliev

Jun 13th, 2022 04:51 AM

Best Answer

Hey Roger,

What is the SMTP port that you are using? Also what is the SMTP encryption set to in your env file?

Usually, I would suggest using port 587 with tls, here is how the env file would look like in this case:

MAIL_MAILER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=apikey
MAIL_PASSWORD=sendgrid_api_key
MAIL_ENCRYPTION=tls

For more information you can take a look at the following tutorial that I've written some time ago:

How To Create a Laravel Contact Form and Send Emails with SendGrid

Let me know how it goes!

Best,

Bobby

Report
3
zodman

Jun 20th, 2022 07:14 PM

It's because the smtp server that you are connecting don't valide your client connection. I suggest disabling the SSL verification. https://stackoverflow.com/a/42944495

jcarlosr

Aug 7th, 2022 05:14 PM

@zodman Disabling SSL isn't a bad practice?